how to find duplicate characters in a string